package com.zito.health.controller;

import com.zito.health.common.annotations.ResponseResult;
import com.zito.health.common.result.VerifyResult;
import com.zito.health.entity.LaboratoryLinkman;
import com.zito.health.service.LaboratoryLinkmanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: gxt
 * @time: 2019/11/19 11:22
 */
@Slf4j
@ResponseResult
@RestController
@RequestMapping("/laboratoryLinkman")
public class LaboratoryLinkmanController {

    @Autowired
    private LaboratoryLinkmanService laboratoryLinkmanService;

    @PostMapping()
    public VerifyResult save(LaboratoryLinkman laboratoryLinkman){
        VerifyResult verifyResult = new VerifyResult();
        if(laboratoryLinkman.getId()!=null){
            laboratoryLinkmanService.update(laboratoryLinkman);
        }else {
            laboratoryLinkmanService.save(laboratoryLinkman);
        }
        return verifyResult;
    }

    @GetMapping("/queryByLaboratoryId")
    public LaboratoryLinkman queryByLaboratoryId(Integer laboratoryId){
        LaboratoryLinkman param = new LaboratoryLinkman();
        param.setLaboratoryId(laboratoryId);
        LaboratoryLinkman laboratoryLinkman = laboratoryLinkmanService.queryOne(param);
        return laboratoryLinkman;
    }
}
